package com.definesys.smecrailtransit.widget;

import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.GridView;
import android.widget.PopupWindow;

import com.definesys.smecrailtransit.R;
import com.definesys.smecrailtransit.adapter.SelectMonthAdapter.SelectMonthAdapter;
import com.hwangjr.rxbus.Bus;

/**
 * Created by xupeizuo on 2017/8/23.
 */

public class SmecMonthPopWindow extends PopupWindow {

    private Context mContext;
    private Bus mRxbus;
    private SelectMonthAdapter selectMonthAdapter;
    private GridView gridView;

    public SmecMonthPopWindow(Context context, Bus bus,SelectMonthAdapter adapter){
        this.mContext=context;
        this.mRxbus=bus;
        this.selectMonthAdapter=adapter;
        _initPopWindow();
    }

    private void _initPopWindow(){
        View view = LayoutInflater.from(mContext).inflate(R.layout.item_month_pop, null);
        setContentView(view);
        setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
        setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
        setFocusable(true);
        ColorDrawable dw = new ColorDrawable(0x00);
        setBackgroundDrawable(dw);
        gridView=(GridView) view.findViewById(R.id.gridView);
        gridView.setAdapter(selectMonthAdapter);
    }
}
